<?php
/**
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file license.txt or that can be found at 
 * http://code.google.com/p/billboardce/wiki/License.
 *
 * @package    Transition_Data
 * @category   Model
 * @license    http://code.google.com/p/billboardce/wiki/License New BSD License
 * @version    SVN: $Id: $
 */
class Transition_Data extends Ot_Db_Table
{
    /**
     * Name of the table in the database
     *
     * @var string
     */
    protected $_name = 'tbl_plugin_slideoption_transition';
  
    /**
     * Primary key of the table
     *
     * @var string
     */
    protected $_primary = 'slideId';
    
    /**
     * The transition types
     * @var array
     */
    private $_transitionTypes = array(
                                    'none'        => 'None',
                                    'blindX'      => 'Blind X',
                                    'blindY'      => 'Blind Y',
                                    'blindZ'      => 'Blind Z',
                                    'cover'       => 'Cover',
                                    'curtainX'    => 'Curtain X',
                                    'curtainY'    => 'Curtain Y',
                                    'fade'        => 'Fade',
                                    'fadeZoom'    => 'Fade Zoom',
                                    'growX'       => 'Grow X',
                                    'growY'       => 'Grow Y',
                                    'scrollUp'    => 'Scroll Up',
                                    'scrollDown'  => 'Scroll Down',
                                    'scrollLeft'  => 'Scroll Left',
                                    'scrollRight' => 'Scroll Right',
                                    'scrollHorz'  => 'Scroll Horizontal',
                                    'scrollVert'  => 'Scroll Vertical',
                                    'slideX'      => 'Slide X',
                                    'slideY'      => 'Slide Y',
                                    'turnUp'      => 'Turn Up',
                                    'turnDown'    => 'Turn Down',
                                    'turnLeft'    => 'Turn Left',
                                    'turnRight'   => 'Turn Right',
                                    'uncover'     => 'Uncover',
                                    'wipe'        => 'Wipe',
                                    'zoom'        => 'Zoom'
                                ); 

    /**
     * Generates the form for adding and editing a slide's schedule data
     * 
     * @param array $values The values the form should be populated with
     * @return Zend_Form
     */
    public function form($values = array())
    {
        $form = new Zend_Form();
        $form->setAttrib('class', 'slideOptionForm')
             ->setDecorators(array(
                     'FormElements',
                     array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')),
                     'Form'
             ));
             
        $transition = $form->createElement('select', 'transition', array('label' => 'Transition:'));
        $transition->setRequired(false)
                   ->setMultiOptions($this->_transitionTypes)
                   ->setValue(isset($values['transition']) ? $values['transition'] : 'none');
        
        $form->addElements(array($transition));

        $form->setElementDecorators(array(
                  'ViewHelper',
                  'Errors',
                  array('HtmlTag', array('tag' => 'div', 'class' => 'elm')),
                  array('Label', array('tag' => 'span')),
              ));
        
        return $form;
    }    
}